<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="CSI.Directory.Core.Model"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div class="main_center_content">
<div class="left_content">
<% Html.RenderPartial("/Views/Shared/LeftMenu.ascx"); %>      
   <script type='text/javascript'><!--      //<![CDATA[
      var m3_u = (location.protocol == 'https:' ? 'https://www.eaglefordflyer.com/advertise/www/delivery/ajs.php' : 'http://www.eaglefordflyer.com/advertise/www/delivery/ajs.php');
      var m3_r = Math.floor(Math.random() * 99999999999);
      if (!document.MAX_used) document.MAX_used = ',';
      document.write("<scr" + "ipt type='text/javascript' src='" + m3_u);
      document.write("?zoneid=5");
      document.write('&amp;cb=' + m3_r);
      if (document.MAX_used != ',') document.write("&amp;exclude=" + document.MAX_used);
      document.write(document.charset ? '&amp;charset=' + document.charset : (document.characterSet ? '&amp;charset=' + document.characterSet : ''));
      document.write("&amp;loc=" + escape(window.location));
      if (document.referrer) document.write("&amp;referer=" + escape(document.referrer));
      if (document.context) document.write("&context=" + escape(document.context));
      if (document.mmm_fo) document.write("&amp;mmm_fo=1");
      document.write("'><\/scr" + "ipt>");
//]]>--></script><noscript><a href='http://www.eaglefordflyer.com/advertise/www/delivery/ck.php?n=a7029c74&amp;cb=7' target='_blank'><img src='http://www.eaglefordflyer.com/advertise/www/delivery/avw.php?zoneid=5&amp;cb=7&amp;n=a7029c74' border='0' alt='' /></a></noscript>
                      
</div><!--end of left content-->

<div class="right_content">
   
          <div id="listings">
              <table>
                  <tr valign="top">
                    <td style="width:75%"><h2><%=((Listing)ViewData["Listing"]).Name%></h2></td>
                    <td align="right"><h2><%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Phone)) {%><%=((Listing)ViewData["Listing"]).Phone %><br />   <%} %></h2></td>
                  </tr>
              </table>
              <table>
                  <tr>
                      <td colspan="2">
                        
                        <img src="/Assets/Images/folder-open.png" style="vertical-align:middle" />
                        <% foreach (var c in ((Listing)ViewData["Listing"]).Categories){%>
                            <a href="/Directory/GetCategory/<%=c.Id %>"><%=c.Name %></a> &nbsp;
                        <%} %>
                        <div style="font-size:10px;color:#666">
                        <img src="/Assets/Images/clock.png" style="vertical-align:middle" />
                        <%=((Listing)ViewData["Listing"]).CreateDate.ToLongDateString()%></div>
                      </td>
                  </tr>
                  <tr valign="top" >
                    <td width="30%">
                        <div style="border:solid 5px white; width:100px;height:100px;overflow:hidden;">
                            <img src="/Assets/Images/<%= (string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Image)) ? "default.png" : ((Listing)ViewData["Listing"]).Image %>" />
                       </div>
                    </td>
                    <td align="left" width="70%">
                         <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Contact)) {%>
                         <b>Contact Name: </b> <%=((Listing)ViewData["Listing"]).Contact%><br />   <%} %>
                        
                        <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Phone)){ %>
                         <b>Phone: </b><%=((Listing)ViewData["Listing"]).Phone %><br />
                         <%} %>
                         
                         <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).AddressLine1)){ %>
                         <b>Address: </b><%=((Listing)ViewData["Listing"]).AddressLine1 %><br />
                         <%} %>
                         
                         
                         <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).City)){ %>
                         <b>City: </b><%=((Listing)ViewData["Listing"]).City %><br />
                         <%} %>
                         
                          <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).State)){ %>
                         <b>State: </b><%=((Listing)ViewData["Listing"]).State %><br />
                         <%} %>
                         
                         <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Zip)){ %>
                         <b>Zip: </b><%=((Listing)ViewData["Listing"]).Zip %><br />
                         <%} %>
                         
                         <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Email)) {%>
                            <b>Email: </b><%=((Listing)ViewData["Listing"]).Email%><br />   
                         <%} %>
                         <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Url))
                           { %>
                               <b>Web: </b> <a target="_blank" href="<%=((Listing)ViewData["Listing"]).Url %>"><%=((Listing)ViewData["Listing"]).Url %></a><br />
                         <%} %>
                    </td>
                 </tr>
                 <tr>
                    <td colspan="2">
                    <b>Decription</b><br />
                    <%if (!string.IsNullOrEmpty(((Listing)ViewData["Listing"]).Description))
                       { %>
                       <div >
                        <p style="padding-top:5px;clear:both;white-space:pre;word-wrap:break-word;"> 
                            <%= ((Listing)ViewData["Listing"]).Description%>
                        </p>
                       </div>
                     
                    <%} %>
                    </td>
                    
                  </tr>
                  <tr>
                  <td colspan="2">
                  <div id="map_canvas" style="width: 500px; height: 480px;"></div>
                  </td>
                  </tr>
              </table>
             
             
               
                    
             
            
             
             
             
          </div>
          
          <br /> 
          <br />
          
          
       
</div>
<div class="clear"></div>
</div>
<script type="text/javascript">
    var geocoder;
    var map;
    var address = '<%=((Listing)ViewData["Listing"]).AddressLine1 %> <%=((Listing)ViewData["Listing"]).City %> <%=((Listing)ViewData["Listing"]).State %>, <%=((Listing)ViewData["Listing"]).Zip %>';

    $(document).ready(function() {

        if ($.trim(address) == ",") {
            $("#map_canvas").remove();
            return;
        }
        geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(-34.397, 150.644);
        var myOptions = {
            zoom: 12,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

        geocoder.geocode({ 'address': address }, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                });
            }
            //            else {
            //                alert("Geocode was not successful for the following reason: " + status);
            //            }
        });
    });

   
</script>
</asp:Content>
